

#pragma once
#ifndef ZGEOMENT_DBSOL3D_H
#define ZGEOMENT_DBSOL3D_H

#include "zdbmain.h"
#include "zdbsubeid.h"
#include "zgepnt3d.h"
#include "zgevec3d.h"
#include "zacarray.h"
#include "zdbsurf.h"

#pragma pack(push, 8)
struct LoftData;
class UcDb3dSolid: public  UcDbEntity
{
public:
    UCDB_DECLARE_MEMBERS(UcDb3dSolid);
    UcDb3dSolid();
    virtual ~UcDb3dSolid();

    virtual Ucad::ErrorStatus createBox(double xLen, double yLen, double zLen);
    virtual Ucad::ErrorStatus createFrustum(double height, double xRadius,
        double yRadius, double topXRadius);
    virtual Ucad::ErrorStatus createSphere(double radius);
    virtual Ucad::ErrorStatus createTorus(double majorRadius, double minorRadius);
    virtual Ucad::ErrorStatus createPyramid(double height, int sides,
        double radius, double topRadius = 0.0 );
    virtual Ucad::ErrorStatus createWedge(double xLen, double yLen, double zLen);
    virtual Ucad::ErrorStatus extrude(const UcDbRegion* region, double height,
        double taperAngle = 0.0);
    virtual Ucad::ErrorStatus extrudeAlongPath(const UcDbRegion* region,
        const UcDbCurve* path, double taperAngle = 0.0);

	virtual Ucad::ErrorStatus sweep(short flag, const UcDbEntity* sheet, const UcDbCurve* path,
		int clor, const UcGePoint3d &basepoint, const UcGePoint3d &origin, const UcGeMatrix3d &mat,
		double scale, double twist);

	virtual Ucad::ErrorStatus loft(short flag, const UcArray<UcDbEntity*>& lofts, 
		const UcArray<UcDbEntity*>& guides, UcDbCurve* path, const LoftData* loftmode, int color);

    virtual Ucad::ErrorStatus revolve(const UcDbRegion* region,
        const UcGePoint3d& axisPoint, const UcGeVector3d& axisDir,
        double angleOfRevolution);

    virtual Ucad::ErrorStatus createRevolvedSolid ( UcDbEntity* pRevEnt,
                                                    const UcGePoint3d& axisPnt,
                                                    const UcGeVector3d& axisDir,
                                                    double revAngle, double startAngle,
                                                    UcDbRevolveOptions& revolveOptions );
    virtual Ucad::ErrorStatus createRevolvedSolid ( UcDbEntity* pRevEnt,
                                                    const UcDbSubentId& faceSubentId,
                                                    const UcGePoint3d& axisPnt,
                                                    const UcGeVector3d& axisDir,
                                                    double revAngle, double startAngle,
                                                    UcDbRevolveOptions& revolveOptions );

    virtual Ucad::ErrorStatus createSweptSolid ( UcDbEntity* pSweepEnt,
                                                 UcDbEntity* pPathEnt,
                                                 UcDbSweepOptions& sweepOptions );
    virtual Ucad::ErrorStatus createSweptSolid ( UcDbEntity *pSweepEnt,
                                                 const UcDbSubentId& faceSubentId,
                                                 UcDbEntity* pPathEnt,
                                                 UcDbSweepOptions& sweepOptions );

    virtual Ucad::ErrorStatus createExtrudedSolid ( UcDbEntity* pSweepEnt,
                                                    const UcGeVector3d& directionVec,
                                                    UcDbSweepOptions& sweepOptions );
    virtual Ucad::ErrorStatus createExtrudedSolid ( UcDbEntity* pSweepEnt,
                                                    const UcDbSubentId& faceSubentId,
                                                    const UcGeVector3d& directionVec,
                                                    UcDbSweepOptions& sweepOptions );
    virtual Ucad::ErrorStatus createExtrudedSolid ( UcDbEntity* pSweepEnt,
                                                    const UcDbSubentId& faceSubentId,
                                                    double height,
                                                    UcDbSweepOptions& sweepOptions );
    
    virtual Ucad::ErrorStatus createLoftedSolid (
        UcArray<UcDbEntity*>& crossSectionCurves,
        UcArray<UcDbEntity*>& guideCurves,
        UcDbEntity* pPathCurve, UcDbLoftOptions& loftOptions );

	virtual Ucad::ErrorStatus createFrom(const UcDbEntity* pFromEntity);

    virtual  Ucad::ErrorStatus getArea(double& area) const;
	UCDB_PORT virtual void dragStatus(const UcDb::DragStat);
	virtual void* ZSMBodyCopy(bool bDeepCopy = false) const;
	virtual void const * getLockedZSMBody();
	virtual void unlockZSMBody(); 
	virtual void*             getLockedWritableZSMBody();
	virtual void              commitWritableZSMBody();
	virtual Ucad::ErrorStatus setZSMBody(const void* modelerBody);


    virtual Ucad::ErrorStatus checkInterference(const UcDb3dSolid* otherSolid,
        ZSoft::Boolean createNewSolid, ZSoft::Boolean& solidsInterfere,
        UcDb3dSolid*& commonVolumeSolid)const;

    virtual Ucad::ErrorStatus getMassProp(double& volume,
        UcGePoint3d& centroid, double momInertia[3], double prodInertia[3],
        double prinMoments[3], UcGeVector3d prinAxes[3], 
        double radiiGyration[3], UcDbExtents& extents) const;

    virtual ZSoft::Boolean isNull() const;
    virtual void list() const;

    virtual Ucad::ErrorStatus getSection(const UcGePlane& plane,
        UcDbRegion*& sectionRegion) const;

    virtual Ucad::ErrorStatus stlOut(const ZTCHAR* fileName,
        ZSoft::Boolean asciiFormat, double maxSurfaceDeviation = 0.0 ) const;

    virtual UcDbSubentId internalSubentId(void* ent) const;          
    virtual void* internalSubentPtr(const UcDbSubentId& id) const;

    virtual Ucad::ErrorStatus getSubentPathsAtGsMarker(UcDb::SubentType type,
        ZSoft::GsMarker gsMark, const UcGePoint3d&  pickPoint,
        const UcGeMatrix3d& viewXform, int& numPaths, 
        UcDbFullSubentPath*& subentPaths, int numInserts = 0,
        UcDbObjectId* entAndInsertStack = NULL) const;

    virtual  Ucad::ErrorStatus getGsMarkersAtSubentPath(
        const UcDbFullSubentPath& subPath, UcArray<ZSoft::GsMarker>& gsMarkers) const;
    virtual UcDbEntity* subentPtr(const UcDbFullSubentPath& id) const;

    virtual Ucad::ErrorStatus booleanOper(UcDb::BoolOperType operation,
        UcDb3dSolid* solid);

    virtual Ucad::ErrorStatus getSlice(const UcGePlane& plane,
        ZSoft::Boolean getNegHalfToo, UcDb3dSolid*& negHalfSolid);
    virtual Ucad::ErrorStatus getSlice(UcDbSurface* pSurface,
        bool bGetNegHalfToo, UcDb3dSolid*& pNegHalfSolid);

    virtual ZSoft::UInt32 numChanges() const;

    virtual Ucad::ErrorStatus copyEdge(const UcDbSubentId &subentId,
        UcDbEntity *&newEntity);
    virtual Ucad::ErrorStatus copyFace(const UcDbSubentId &subentId,
        UcDbEntity *&newEntity);
    virtual Ucad::ErrorStatus extrudeFaces(
        const UcArray<UcDbSubentId *> &faceSubentIds, double height, 
        double taper);
    virtual Ucad::ErrorStatus extrudeFacesAlongPath(
        const UcArray<UcDbSubentId *> &faceSubentIds, const UcDbCurve* path);
    virtual Ucad::ErrorStatus imprintEntity(const UcDbEntity *pEntity);
    virtual Ucad::ErrorStatus cleanBody();
    virtual Ucad::ErrorStatus offsetBody(double offsetDistance);
    UCDB_PORT virtual Ucad::ErrorStatus offsetFaces(
        const UcArray<UcDbSubentId *> &faceSubentIds, double offsetDistance);
    virtual Ucad::ErrorStatus removeFaces(
        const UcArray<UcDbSubentId *> &faceSubentIds);
    virtual Ucad::ErrorStatus separateBody(UcArray<UcDb3dSolid *> &newSolids);
    virtual Ucad::ErrorStatus shellBody(
        const UcArray<UcDbSubentId *> &faceSubentIds, double offsetDistance);
    virtual Ucad::ErrorStatus taperFaces(
        const UcArray<UcDbSubentId *> &faceSubentIds, 
        const UcGePoint3d &basePoint, const UcGeVector3d &draftVector,
        double draftAngle);
    virtual Ucad::ErrorStatus transformFaces(
        const UcArray<UcDbSubentId *> &faceSubentIds,
        const UcGeMatrix3d &matrix);

    virtual Ucad::ErrorStatus setSubentColor(const UcDbSubentId &subentId,
        const UcCmColor &color);
    virtual Ucad::ErrorStatus getSubentColor(const UcDbSubentId &subentId,
        UcCmColor &color) const;

    virtual Ucad::ErrorStatus setSubentMaterial(const UcDbSubentId &subentId,
                                                UcDbObjectId matId);
    virtual Ucad::ErrorStatus getSubentMaterial(const UcDbSubentId &subentId,
                                                UcDbObjectId& matId) const;


    virtual Ucad::ErrorStatus setSubentMaterialMapper(const UcDbSubentId &subentId,
                                                    const UcGiMapper& mapper);
    virtual Ucad::ErrorStatus getSubentMaterialMapper(const UcDbSubentId &subentId,
                                                    UcGiMapper& mapper) const;

    virtual ZSoft::Boolean    worldDraw(UcGiWorldDraw* pWd);
    virtual void              viewportDraw(UcGiViewportDraw *pVpDraw);

    virtual Ucad::ErrorStatus getClassID(CLSID* pClsid) const;

    virtual bool recordHistory() const;

    virtual Ucad::ErrorStatus setRecordHistory(bool bRecord);

    virtual bool showHistory() const;

    virtual Ucad::ErrorStatus setShowHistory(bool bShow);

    virtual Ucad::ErrorStatus convertToBrepAtSubentPaths(
                                 const UcDbFullSubentPathArray& paths);

    virtual Ucad::ErrorStatus chamferEdges(
                            const UcArray<UcDbSubentId *> &edgeSubentIds,
                            const UcDbSubentId& baseFaceSubentId,
                            double baseDist, double otherDist);

    virtual Ucad::ErrorStatus filletEdges(
                            const UcArray<UcDbSubentId *> &edgeSubentIds,
                            const UcGeDoubleArray& radius,
                            const UcGeDoubleArray& startSetback,
                            const UcGeDoubleArray& endSetback);
	UCDB_PORT virtual bool usesGraphicsCache();
};

#pragma pack(pop)

#endif
